package com.pany.utils;

import java.util.UUID;

public class UUIDGenerator
{

    public static String generate()
    {
        UUID id = UUID.randomUUID();
        long bits = id.getMostSignificantBits();
        return (digits(bits >> 32, 8) + digits(bits >> 16, 4) + digits(bits, 4)
                + digits(bits >> 48, 4) + digits(bits, 12));
    }

    private static String digits(long val, int digits)
    {
        long hi = 1L << (digits << 2);
        return Long.toHexString(hi | (val & (hi - 1))).substring(1);
    }

    public static void main(String[] args)
    {
        for (int i = 0; i < 10; i++)
        {
            
            System.out.println(generate());
        }
    }
}
